var current_widget={
     currentUser: function () {
            return {
                restrict: 'E',
                replace: true,
                scope: 'bind',
                templateUrl: '/user/current_user.html',
                controller:function($scope,$location,dfg,currentUser) {
                    $scope.user=currentUser;
                    if(!currentUser.id){
                        $location.url("/login");
                    }
                    $scope.welcome = "欢迎";
                    $scope.logout=function(){
                        currentUser={};
                        var localStorage=window.localStorage;
                        if(localStorage){
                            localStorage.removeItem('user');
                        }
                        $location.path('/login');
                    }
                }
            }
     }
};